function OP_UB = RDEU_OP_UB_PL(State, State_PROB, ...
                               K, CPFlag, TTM, S0, S0_ADJ, RF, DY, TC, ...
                               AllSlope, TP)
% The code is based on the following paper:
%   Chen, T. Y., Lin, Y. L., and Tzeng, L. Y., forthcoming.
%   Estimating probability weighting functions through option pricing bounds. Review of Asset Pricing Studies.
%
% Copyright: Tzu-Ying Chen, Yo-Lan Lin, Larry Y. Tzeng
% Date: January 30, 2024
                           
CDF = cumsum(State_PROB);
CDF(end) = 1;                                                              
CDF = FitPWF_PL(CDF, AllSlope, TP);                                             
State_PROB = [CDF(:, 1) diff(CDF')'];                                          

OP_UB_C = ((1 + TC) / (1 - TC)) * ...
          S0' .* (State_PROB * max(State - (K ./ S0), 0)') .* ...
          power(sum(State_PROB .* State, 2), - 1);        

OP_UB = OP_UB_C;